#ifndef GRAPHICS_H
#define GRAPHICS_H

#include "def.h"
#include "cmus-rg.h"
#include "parser.h"

extern SDL_Window *window;
extern SDL_Renderer *render;
extern SDL_Texture *display;
extern TTF_Font *font;

extern track *cr_track;
extern player *cr_player;

/* tracks whether to update the render (whenever the render is externally changed, this is set to true) */
extern bool render_changed;
extern int max_l_w;

void init_graphics();
void cleanup_graphics();

void set_render_changed();
void pre_render();
void update_render();

void draw_frames(int frame);
void draw_cover_art();
void draw_info();

void draw_bg(uint32_t color);
void draw_rect(int x, int y, int w, int h);
void draw_text_and_bg(int x, int y, char *text, uint32_t color);
void draw_text(int x, int y, char *text, uint32_t color);
void draw_img(char *file, SDL_Rect* rect);

int partr(uint32_t color);
int partg(uint32_t color);
int partb(uint32_t color);
int parta(uint32_t color);

int posx(int x, int w);
int posy(int y, int w);

#endif